package com.cqc.bannerdemo01;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import com.youth.banner.Banner;
import com.youth.banner.BannerConfig;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private Banner banner;
    private List<String> urlList = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initImageList();
        banner = (Banner) findViewById(R.id.banner);
        //设置图片加载器
        banner.setImageLoader(new GlideImageLoader());
        //设置图片集合
        banner.setImages(urlList);
        //开启轮播
        banner.start();
    }

    private void initImageList() {
        urlList.add("http://img5.pcpop.com/ArticleImages/fnw/2016/1104/405119ea-4880-41e2-bc5b-b25d01d26765.jpg");
        urlList.add("http://img4.imgtn.bdimg.com/it/u=1790912434,484619628&fm=11&gp=0.jpg");
        urlList.add("http://i7.hexunimg.cn/2015-08-18/178405029.jpg");
        urlList.add("http://a3.att.hudong.com/31/74/01200000030880126871746666933.jpg");
        urlList.add("http://img.ph.126.net/eLh1TgK75sOIN020SadJeA==/2534682165296384342.png");
    }
}
